//
//  VioPunishmentView.m
//  carcareIOS
//
//  Created by ileo on 16/8/18.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "VioPunishmentView.h"

@interface VioPunishmentView ()

@property (nonatomic, strong) UILabel *vMoneyL;
@property (nonatomic, strong) UILabel *vPointL;

@end

@implementation VioPunishmentView

- (instancetype)initWithFrame:(CGRect)frame gap:(CGFloat)gap
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.vMoneyL = [[[UILabel viewWithFrame:CGRectMake(gap, 0, 80 * __MAIN_RATIO_375,self.height)] labelResetTextAlignment:NSTextAlignmentLeft] setupOnView:self];
        self.vPointL = [[[UILabel viewWithCenterX:self.width / 2 top:self.vMoneyL.top size:self.vMoneyL.size] labelResetTextAlignment:NSTextAlignmentCenter] setupOnView:self];
        [[[[UILabel viewWithRight:self.width - gap top:self.vMoneyL.top size:self.vMoneyL.size] labelResetTextAlignment:NSTextAlignmentRight]labelResetAttributedText:[NSAttributedString attributedStringWithText:@"未处理" color:COLOR_HEXSTRING(@"#fd6500") font:FONT_DEFAULT_Light(12)]] setupOnView:self];
    }
    return self;
}

-(void)setPunishmentMoney:(CGFloat)money point:(NSInteger)point{
    self.vMoneyL.attributedText = [self attWithValue:[NSString stringWithFormat:@"%0.0f元",money] title:@"罚款"];
    self.vPointL.attributedText = [self attWithValue:[NSString stringWithFormat:@"%zd分",point] title:@"扣分"];
}


-(NSAttributedString *)attWithValue:(NSString *)value title:(NSString *)title{
    NSAttributedString *att1 = [[[NSAttributedString attributedStringWithText:title] copyAttributedStringWithFont:FONT_DEFAULT_Light(12)] copyAttributedStringWithColor:COLOR_HEXSTRING(@"#908f8f")];
    NSAttributedString *att2 = [NSAttributedString attributedStringWithSpaceNum:2];
    NSAttributedString *att3 = [[[NSAttributedString attributedStringWithText:value] copyAttributedStringWithFont:FONT_DEFAULT_Light(12)] copyAttributedStringWithColor:COLOR_HEXSTRING(@"#fd6500")];
    
    return [NSAttributedString attributedStringWithAttributedStrings:@[att1,att2,att3]];
}


@end
